<template>
  <div class="other-system-box">
    <iframe
      :style="{'min-height':minHeight}"
      class="frame"
      v-bind:src="reportUrl"
    ></iframe>
  </div>
</template>
<script>
import { SUPPLIER_SYNERGY_HOST } from '../constants'
import Cookies from 'js-cookie'

export default {
  data () {
    return {
      reportUrl: '',
      minHeight: `${document.body.clientHeight - 118}px`,
    };
  },
  beforeRouteEnter (to, from, next) {
    next((vm) => {
      const ucToken = Cookies.get().uc_token;
      vm.reportUrl = `${SUPPLIER_SYNERGY_HOST}${to.name}?uc_token=${ucToken}&systemName=GPT`;
      console.log(vm.reportUrl)
    });
  },
  beforeRouteUpdate (to, from, next) {
    console.log('update')
    next();
  },
};
</script>
<style lang="less">
.frame{
  width: 100%;
  height: 100%;
  border-width: 2px;
  border-style: inset;
  border-color: initial;
  border-image: initial;
  border-top-width: 0px;
  border-right-width: 0px;
  border-bottom-width: 0px;
  border-left-width: 0px;
}
</style>
